import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    // 路由懒加载的引入
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    // 1.配置好路由path添加/对象接受
    path: '/detailview/:goodsId',
    name: 'detailview',
    // 路由懒加载的引入
    component: () => import('../views/DetailView.vue'),
  },

]

const router = new VueRouter({
  routes,
  mode: "history"
})

export default router
